package cn.cvs.service.blog;

import cn.cvs.dao.blog.BlogMapper;
import cn.cvs.pojo.Blog;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class BlogServiceImpl implements BlogService {

    @Resource
    private BlogMapper blogMapper;

    @Override
    public List<Blog> queryPageList(String date, Integer pageIndex, Integer pageSize) {
        int pageBegin = (pageIndex-1)*pageSize;
        return blogMapper.list(date,pageBegin,pageSize);
    }

    @Override
    public int count(String date) {
        return blogMapper.count(date);
    }

    @Override
    public int removeById(Integer id) {
        return blogMapper.deleteById(id);
    }

    @Override
    public int modifyById(Blog blog) {
        return blogMapper.updateById(blog);
    }

    @Override
    public Blog queryById(Integer id) {
        return blogMapper.selectById(id);
    }

    @Override
    public int save(Blog blog) {
        return blogMapper.insert(blog);
    }
}
